package com.seata.demo.cloud.client;

import com.seata.demo.cloud.dto.ProductDTO;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestParam;

@FeignClient(name = "seata-cloud-product",path = "/product")
public interface ProductClient {

    @GetMapping("/getPrice")
    Integer getPrice(@RequestParam("productId") Long productId);

    @PostMapping("/reduceStock")
    boolean reduceStock(@RequestBody ProductDTO productDTO) throws Exception;

    @PostMapping("/reduceStockTCC")
    boolean reduceStockTCC(@RequestBody ProductDTO productDTO) throws Exception;
}
